webpackJsonp([13],{

/***/ 0:
/***/ (function(module, exports, __webpack_require__) {


window._ = __webpack_require__(2);

/**
 * We'll load jQuery and the Bootstrap jQuery plugin which provides support
 * for JavaScript based Bootstrap features such as modals and tabs. This
 * code may be modified to fit the specific needs of your application.
 */

/*try {
    window.$ = window.jQuery = require('jquery');

    require('bootstrap-sass');
} catch (e) {}*/

/**
 * We'll load the axios HTTP library which allows us to easily issue requests
 * to our Laravel back-end. This library automatically handles sending the
 * CSRF token as a header based on the value of the "XSRF" token cookie.
 */

window.axios = __webpack_require__(3);

window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';

/**
 * Next we will register the CSRF Token as a common header with Axios so that
 * all outgoing HTTP requests automatically have it attached. This is just
 * a simple convenience so we don't have to attach every token manually.
 */

var token = document.head.querySelector('meta[name="csrf-token"]');

if (token) {
  window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content;
} else {
  console.error('CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token');
}

/**
 * Echo exposes an expressive API for subscribing to channels and listening
 * for events that are broadcast by Laravel. Echo and event broadcasting
 * allows your team to easily build robust real-time web applications.
 */

// import Echo from 'laravel-echo'

// window.Pusher = require('pusher-js');

// window.Echo = new Echo({
//     broadcaster: 'pusher',
//     key: 'your-pusher-key'
// });

/***/ }),

/***/ 1:
/***/ (function(module, exports) {

//设置toastr选项
toastr.options = {
    "closeButton": true,
    "debug": false,
    "progressBar": true,
    "preventDuplicates": false,
    "positionClass": "toast-top-right",
    "onclick": null,
    "showDuration": "400",
    "hideDuration": "1000",
    "timeOut": "1000",
    "extendedTimeOut": "1000",
    "showEasing": "swing",
    "hideEasing": "linear",
    "showMethod": "fadeIn",
    "hideMethod": "fadeOut"
};
window.utils = {
    /**
     *
     * @param data json响应数据
     * @param loadtag 载入标签
     */
    showToastr: function showToastr(data) {
        var loadtag = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';

        switch (data.status) {
            case 'success':
                toastr.success(data.message, data.title);
                break;
            case 'error':
                toastr.error(data.message, data.title);
                break;
            case 'info':
                toastr.info(data.message, data.title);
                break;
            default:
                toastr.warning(data.message, data.title);
                break;
        }
        if (data.status == 'success') {
            switch (loadtag) {
                case 'reload':
                    utils.reload(data.jumpTime);
                    break;
                case 'goback':
                    utils.goback(data.jumpTime);
                    break;
                case 'go':
                    if (data.url) {
                        utils.redirect(data.url, data.jumpTime);
                    }
                    break;
                default:
                    break;
            }
        }
    },
    bootstraptableOptions: {
        url: '', //请求地址
        method: 'get', //请求方式（*）
        toolbar: '#toolbar', //工具按钮用哪个容器
        striped: true, //是否显示行间隔色
        cache: false, //是否使用缓存，默认为true，所以一般情况下需要设置一下这个属性（*）
        pagination: true, //是否显示分页（*）
        sortable: false, //是否启用排序
        sortOrder: "asc", //排序方式
        sidePagination: "server", //分页方式：client客户端分页，server服务端分页（*）
        pageNumber: 1, //初始化加载第一页，默认第一页
        pageSize: 10, //每页的记录行数（*）
        pageList: [10, 25, 50, 100], //可供选择的每页的行数（*）
        paginationFirstText: "首页",
        paginationPreText: "上一页", //分页条中上一页按钮的图标或文字
        paginationNextText: "下一页", //分页条中下一页按钮的图标或文字
        paginationLastText: "尾页",
        queryParamsType: "", //limit:获取页面偏移量offset和页面大小pageSize,"":获取当前页数pageNumber和页面大小pageSize
        responseHandler: function responseHandler(response) {
            return {
                rows: response.data,
                total: response.total
            };
        },
        search: false, //是否显示表格搜索，此搜索是客户端搜索，不会进服务端，所以，个人感觉意义不大
        contentType: "application/x-www-form-urlencoded",
        strictSearch: true,
        showColumns: true, //是否显示所有的列
        showRefresh: true, //是否显示刷新按钮
        minimumCountColumns: 2, //最少允许的列数
        clickToSelect: true, //是否启用点击选中行
        uniqueId: "no", //每一行的唯一标识，一般为主键列
        showToggle: true, //是否显示详细视图和列表视图的切换按钮
        cardView: false, //是否显示详细视图
        detailView: false, //是否显示父子表
        icons: {
            refresh: 'fa fa-refresh',
            detailOpen: 'fa fa-tasks',
            toggle: 'fa fa-exchange'
        },
        onLoadSuccess: function onLoadSuccess(res) {
            //加载成功时执行
            layer.msg("加载成功", { time: 1000 });
        },
        onLoadError: function onLoadError() {
            //加载失败时执行
            layer.msg("加载数据失败");
        }
    },
    /**
     * 确认框
     * @param url
     * @param data
     * @param title
     * @param content
     */
    confirm: function confirm(url) {
        var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
        var callback = arguments[2];
        var title = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '你确定删除么？';
        var content = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : '删除后将无法恢复';

        layer.confirm(content, { icon: 3, title: title }, function (index) {
            axios.post(url, data).then(function (response) {
                if (callback) {
                    callback.call(null, response, data);
                } else {
                    utils.showToastr(response.data, 'go');
                }
            }).catch(function (error) {
                if (error.response) {
                    utils.showToastr({
                        'status': 'error',
                        'title': error.response.title,
                        'message': error.response.message
                    });
                } else if (error.request) {
                    console.log(error.request);
                } else {
                    utils.showToastr({ 'status': 'error', 'title': '请求错误', 'message': error });
                }
            });

            layer.close(index);
        });
    },
    /**
     * 页面跳转，重定向
     * @param url 跳转链接
     * @param times 等待时间
     */
    redirect: function redirect(url) {
        var times = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1000;

        if (times > 0) {
            setTimeout(function () {
                window.location.href = url;
            }, times);
        } else {
            window.location.href = url;
        }
    },
    /**
     * 页面刷新
     * @param times 等待时间
     */
    reload: function reload() {
        var times = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1000;

        if (times) {
            setTimeout(function () {
                window.location.reload();
            }, times);
        } else {
            window.location.reload();
        }
    },
    /**
     * 页面返回
     * @param times 等待时间
     */
    goback: function goback() {
        var times = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1000;

        if (times) {
            setTimeout(function () {
                window.history.back(-1);
            }, times);
        } else {
            window.history.back(-1);
        }
    },
    /**
     * 异步post请求
     * @param posturl
     * @param data
     * @param callback
     */
    ajaxPost: function ajaxPost(posturl) {
        var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
        var callback = arguments[2];

        axios.post(posturl, data).then(function (response) {
            if (callback) {
                callback.call(null, response, data);
            } else {
                utils.showToastr(response.data, 'go');
            }
        }).catch(function (error) {
            if (error.response) {
                utils.showToastr({
                    'status': 'error',
                    'title': error.response.title,
                    'message': error.response.message
                });
            } else if (error.request) {
                console.log(error.request);
            } else {
                utils.showToastr({ 'status': 'error', 'title': '请求错误', 'message': error });
            }
        });
    },
    /**
     * 异步get请求
     * @param posturl
     * @param data
     * @param callback
     */
    ajaxGet: function ajaxGet(geturl) {
        var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
        var callback = arguments[2];

        axios.get(geturl, {
            params: data
        }).then(function (response) {
            if (callback) {
                callback.call(null, response, data);
            } else {
                utils.showToastr(response.data, 'go');
            }
        }).catch(function (error) {
            if (error.response) {
                utils.showToastr({
                    'status': 'error',
                    'title': error.response.title,
                    'message': error.response.message
                });
            } else if (error.request) {
                console.log(error.request);
            } else {
                utils.showToastr({ 'status': 'error', 'title': '请求错误', 'message': error });
            }
        });
    },
    /**
     * 异步提交表单
     * @param posturl
     * @param data
     */
    ajaxSubmitForm: function ajaxSubmitForm(form, posturl) {
        var otherData = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
        var callback = arguments[3];

        var params = $(form).serializeArray();
        var formData = {};
        for (x in params) {
            formData[params[x].name] = params[x].value;
        }
        var postdata = _.merge(formData, otherData);
        posturl = posturl ? posturl : $(form).attr('action');
        if (!posturl) {
            console.log('表单提交路径为空');
        }
        axios.post(posturl, postdata).then(function (response) {
            if (callback) {
                callback.call(null, response, postdata);
            } else {
                utils.showToastr(response.data, 'go');
            }
        }).catch(function (error) {
            if (error.response) {
                utils.showToastr({
                    'status': 'error',
                    'title': error.response.title,
                    'message': error.response.message
                });
            } else if (error.request) {
                console.log(error.request);
            } else {
                utils.showToastr({ 'status': 'error', 'title': '请求错误', 'message': error });
            }
        });
    }
};

/***/ }),

/***/ 69:
/***/ (function(module, exports, __webpack_require__) {

module.exports = __webpack_require__(70);


/***/ }),

/***/ 70:
/***/ (function(module, exports, __webpack_require__) {

/**
 * 载入项目引导文件
 */
__webpack_require__(0);

window.Vue = __webpack_require__(5);

/**
 * 载入自定义工具
 */

__webpack_require__(1);

var loadBox = void 0; //加载框

var news_empty = {
    'new_id': 0,
    'title': '',
    'thumb_view_url': '',
    'author': '',
    'digest': '',
    'show_cover_pic': 1,
    'content': '',
    'content_source_url': '',
    'news_click_url': '',
    'need_open_comment': 1,
    'only_fans_can_comment': 1
};
var app = new Vue({
    el: '#material',
    data: {
        material_data: {},
        news_index: -1,
        news_cur_data: {},
        news_list: [],
        news_actions_index: -1,
        editor: null
    },
    computed: {
        display_material_data: function display_material_data() //显示到前台的整体素材数据
        {
            if (_.isEmpty(this.material_data)) {
                if (_.isEmpty(page_params.data_material) == false) {
                    this.material_data = page_params.data_material;
                } else {
                    this.material_data = {
                        'material_id': 0,
                        'cat_id': 0,
                        'is_forever': 1
                    };
                }
            }
            return this.material_data;
        },
        display_new_list: function display_new_list() {
            //显示到前台的整体文章列表
            //当图文列表为空的时候
            if (_.isEmpty(this.news_list)) {
                if (_.isEmpty(page_params.data_new_list) == false) {
                    this.news_list = page_params.data_new_list;
                } else {
                    this.news_list.push(news_empty);
                }
                this.news_index = 0;
            }
            return this.news_list;
        },
        news_count: function news_count() {
            return this.news_list.length;
        }
    },
    mounted: function mounted() {
        var _this = this;
        this.editor = UE.getEditor('content', {
            serverUrl: page_params.url_ueditorUpload
        }); // 初始化UE
        var token = document.head.querySelector('meta[name="csrf-token"]');
        this.editor.ready(function () {
            _this.editor.execCommand('serverparam', '_token', token.content);
        });
        this.editor.addListener('contentChange', function () {
            _this.news_cur_data.content = _this.editor.getContent();
        });
    },
    watch: {
        news_index: function news_index(val) {
            //深度拷贝
            this.news_cur_data = _.cloneDeep(this.news_list[val]);
            //监听内容变更
            var _this = this;
            this.editor.ready(function () {
                _this.editor.setContent(_this.news_cur_data.content);
            });
        },
        news_cur_data: function news_cur_data(val) {
            Vue.set(this.news_list, this.news_index, val);
        }
    },
    methods: {
        showActions: function showActions(index) {
            //显示操作层
            this.news_actions_index = index;
        },
        hideActions: function hideActions(index) {
            //隐藏操作层
            this.news_actions_index = -1;
        },
        newsTrash: function newsTrash(index) {
            //删除图文
            //如果删除当前编辑文章，则将文章索引先前一个移动
            if (index == this.news_index) {
                this.news_index = index - 1;
            }
            this.news_list.splice(index, 1);
        },
        newsMonveUp: function newsMonveUp(index) {
            //上移图文
            if (index == 0) {
                utils.showToastr({ 'status': 'error', 'title': '移动错误', 'message': '顶级图文无法继续上移' });
                return false;
            }
            var tempOption = this.news_list[index - 1];
            Vue.set(this.news_list, index - 1, this.news_list[index]);
            Vue.set(this.news_list, index, tempOption);
            if (this.news_index == index) {
                this.news_index = index - 1;
            }
        },
        newsMoveDown: function newsMoveDown(index) {
            //下移图文
            if (index >= this.news_list.length - 1) {
                utils.showToastr({ 'status': 'error', 'title': '移动错误', 'message': '顶级图文无法继续下移' });
                return false;
            }
            var tempOption = this.news_list[index];
            Vue.set(this.news_list, index, this.news_list[index + 1]);
            Vue.set(this.news_list, index + 1, tempOption);
            if (this.news_index == index) {
                this.news_index = index + 1;
            }
        },
        newsEdit: function newsEdit(index) {
            this.news_index = index;
        },
        newsAdd: function newsAdd() {
            //添加图文
            if (this.news_list.length >= 8) {
                utils.showToastr({ 'status': 'error', 'title': '添加图文错误', 'message': '最多只可以加入8条图文消息' });
                return false;
            }
            this.news_list.push(news_empty);
        },
        materialSave: function materialSave() {
            loadBox = layer.load(1, {
                shade: [0.3, '#fff'] //0.1透明度的白色背景
            });
            utils.ajaxPost(page_params.url_add, { material_data: this.material_data, news_list: this.news_list }, function (response, data) {
                layer.close(loadBox);
                utils.showToastr(response.data, 'go');
            });
        }
    }
});

var uploader = WebUploader.create({
    // 选完文件后，是否自动上传。
    auto: true,
    // swf文件路径
    swf: '/vendor/ueditor/third-party/webuploader/Uploader.swf',

    // 文件接收服务端。
    server: page_params.url_webupload,

    // 选择文件的按钮。可选。
    pick: {
        id: '#btn-upload-thumb-view-url',
        name: "file", //这个地方 name 没什么用，虽然打开调试器，input的名字确实改过来了。但是提交到后台取不到文件。如果想自定义file的name属性，还是要和fileVal 配合使用。
        label: '选择封面',
        multiple: false //默认为true，true表示可以多选文件，HTML5的属性
    },
    // 只允许选择图片文件。
    accept: {
        title: 'Images',
        extensions: 'gif,jpg,jpeg,bmp,png',
        mimeTypes: 'image/*'
    },
    //设置文件上传域的name
    fileVal: 'file',
    duplicate: true, //是否可重复选择同一文件
    resize: false,
    compress: null, //图片不压缩
    chunked: true, //分片处理
    fileSingleSizeLimit: 1024 * 1024,
    chunkSize: 5 * 1024 * 1024, //每片5M
    chunkRetry: false, //如果失败，则不重试
    threads: 1, //上传并发数。允许同时最大上传进程数。
    // runtimeOrder: 'flash',
    // 禁掉全局的拖拽功能。这样不会出现图片拖进页面的时候，把图片打开。
    disableGlobalDnd: true
});
uploader.on('uploadBeforeSend', function (block, data, headers) {
    data.fileType = 'image';
    //头部成熟
    var token = document.head.querySelector('meta[name="csrf-token"]');
    headers['X-CSRF-TOKEN'] = token.content;
});
// 文件上传过程中创建进度条实时显示。
uploader.on('uploadProgress', function (file, percentage) {
    loadBox = layer.load(1, {
        shade: [0.3, '#fff'] //0.1透明度的白色背景
    });
});
// 文件上传成功，给item添加成功class, 用样式标记上传成功。
uploader.on('uploadSuccess', function (file, response) {
    layer.close(loadBox);
    if (response.status == 'success' && _.isEmpty(response.data) == false) {
        app.news_cur_data.thumb_view_url = response.data.view_url;
    } else {
        utils.showToastr({ 'status': 'error', 'title': '上传失败', 'message': file.message });
    }
});
// 文件上传失败，显示上传出错。
uploader.on('uploadError', function (file) {
    layer.close(loadBox);
    utils.showToastr({ 'status': 'error', 'title': '上传失败', 'message': '文件上传失败' });
});
// 完成上传完了，成功或者失败，先删除进度条。
uploader.on('uploadComplete', function (file) {});

/***/ })

},[69]);